package acwing._2LanQiao._13No13;
/**
 * @Project : AlgorithmLearning
 * @Package : ACWing._2LanQiao._13No13
 * @File : Q4654.java
 * @Author : WangRuoyu
 * @Date : 2023/3/31 9:35
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Q4654 {
    static final int N = 1000010;
    static int idx = 2;
    static int head = 0;
    static int tail = 1;
    static int[] e = new int[N];
    static int[] next = new int[N];
    static int[] pre = new int[N];

    static void init() {
        next[head] = tail;
        pre[head] = -1;
        next[tail] = -1;
        pre[tail] = head;
    }

    static void add(char s) {
        e[idx] = s;
        pre[idx] = pre[tail];
        next[idx] = tail;
        next[pre[tail]] = idx;
        pre[tail] = idx;
        idx++;
    }

    static void print() {
        for (int i = next[head]; i != tail; i = next[i]) {
            System.out.print((char) e[i]);
        }
    }

    static void create(String str) {
        for (int i = 0; i < str.length(); ++i) {
            add(str.charAt(i));
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        create(line);
        int tmp = 0;

        while (true) {
            int count = 0;
            int p = head;
            int q = next[head];
            int s = next[q];
            while (s != tail) {
                if (p == head) {
                    p = q;
                    q = s;
                    s = next[s];
                    count++;
                    continue;
                }
                if (e[s] == e[q] && e[p] != e[q]) {
                    next[pre[p]] = s;
                    pre[s] = next[pre[p]];
                } else if (e[s] != e[q] && e[p] == e[q]) {
                    next[pre[q]] = next[s];
                    pre[next[s]] = next[pre[q]];
                }
                p = q;
                q = s;
                s = next[s];
                count++;
            }
            if (count == tmp) {
                break;
            }
            tmp = count;
        }

        print();
    }
}

// 暴力 6/11
//public class Q4654 {
//    public static void main(String[] args) throws IOException {
//        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//        String line = br.readLine();
//
//        int lenth = line.length();
//        StringBuilder sb = new StringBuilder(line);
//        while (true) {
//            boolean[] st = new boolean[lenth];
//            for (int i = 0; i < st.length - 1; ++i) {
//                int j = i;
//                while (j < sb.length() - 1 && sb.charAt(j) == sb.charAt(j + 1)) {
//                    j++;
//                }
//                if (i != j) {
//                    if (i >= 1 ) {
//                        st[i] = true;
//                        st[i - 1] = true;
//                    }
//                    if (j + 1 < sb.length()) {
//                        st[j] = true;
//                        st[j + 1] = true;
//                    }
//                }
//                i = j;
//            }
//            for (int i = sb.length() - 1; i >= 0; --i) {
//                if (st[i]) {
//                    sb.delete(i, i + 1);
//                }
//            }
//            if (lenth == sb.length()) {
//                break;
//            }
//            lenth = sb.length();
//        }
//
//        if (sb.length() == 0) {
//            System.out.println("EMPTY");
//            return;
//        }
//        System.out.println(sb);
//    }
//}

